package com.example.girl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class GirlService {

    @Autowired
    private GirlRepository girlRepository;

    // 添加事务注解
    @Transactional
    public void insertTwo(){
        Girl girlA = new Girl();
        //girlA.setId(11);
        girlA.setAge(23);
        girlA.setCupSize("A");

        girlRepository.save(girlA);

        Girl girlB = new Girl();
        //girlB.setId(22);
        girlB.setAge(24);
        girlB.setCupSize("BBBB");

        girlRepository.save(girlB);

    }
}
